<%@page contentType="application/json;charset=UTF-8" %><%@page import="be.destin.skos.core.SkosManager" %><%@page import="be.destin.skos.html.SkosHtmlManager" %><%@page import="be.destin.skos.core.SchemeInterface" %><%@page import="be.destin.skos.view.SkosView" %><%@page import="be.destin.skos.view.SkosViewType" %><%@page import="be.destin.skos.view.SkosViewManager" %><%
	SkosHtmlManager skosHtmlManager = SkosHtmlManager.getAskosiSessionInstance(request);
	SkosManager skosManager = skosHtmlManager.getSkosManager();
	String language = skosHtmlManager.getLanguage();
	String schemeCode = request.getParameter("scheme");
	String sort = request.getParameter("sort");
	SchemeInterface aScheme = skosManager.openScheme(schemeCode);
	if (aScheme != null) {

		SkosViewType viewType = ("alfa".equals(sort) ? SkosViewType.ALFA : SkosViewType.TREE);
		SkosView aView = SkosViewManager.openView(skosHtmlManager,schemeCode, viewType, language,false, null);
		SkosViewManager.renderVocabularyAsJSON(out, aView);
	} else {
	%>{"conceptScheme":{"error":"not loaded","about":"<%=schemeCode%>"}}<%
	}
%>
